package com.gx.controller;

import com.alibaba.fastjson.JSONObject;
import com.gx.common.anntation.Log;
import com.gx.common.result.AppResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName TestAopLogController
 * @Author lpj
 * @Date 2022/5/10 17:56
 **/
@RestController
@Api(tags = "测试生成日志")
@RequestMapping(value = "/test")
@Slf4j
public class TestAopLogController {
    @ApiOperation("保存")
    @GetMapping("/save")
    @Log(description = "系统操作", type = "保存")
    public AppResult<?> save(@RequestParam String name) {
        log.warn("名称:{}保存成功!", name);
        return AppResult.success();
    }

    @ApiOperation("删除")
    @PostMapping("/del/{name}")
    @Log(description = "系统操作", type = "删除")
    public AppResult<?> del(@PathVariable String name, @RequestParam String id, @RequestBody JSONObject json) {
        log.warn("名称:{}删除成功!", name);
        return AppResult.success();
    }
}
